#ifndef HISTORYMESSAGEITEM_H
#define HISTORYMESSAGEITEM_H

#include <QWidget>
#include "model/data.h"
#include <QGridLayout>
#include <QPushButton>
#include <QLabel>
#include "debug.h"
#include "toast.h"
#include <QFileDialog>
#include "soundrecorder.h"



using namespace model;
class HistoryMessageItem : public QWidget
{
    Q_OBJECT
public:
    static HistoryMessageItem* makeHistoryMessageItem(const Message &message);
private:
    const Message &message;
    explicit HistoryMessageItem(const Message &message);
signals:
};

// 图片消息
class ImageButton : public QPushButton
{
    Q_OBJECT
public:
    ImageButton(const QString& fileId ,const QByteArray& content);
    void updateUI(const QString& fileId,const QByteArray& content);
private:
    QString fileId;
};

//文件消息
class FileLabel : public QLabel
{
    Q_OBJECT
public:
    FileLabel(const QString& fileId,const QString& fileName);
    void getContentDone(const QString& fileId, const QByteArray& content);
    void mousePressEvent(QMouseEvent* event);
private:
    QString fileId;
    QString fileName;
    QByteArray content;
    bool loadContentDone = false;
};

class SpeechLabel : public QLabel
{
    Q_OBJECT
public:
    SpeechLabel(const QString& fileId);
    void getContentDone(const QString& fileId, const QByteArray& content);
    void mousePressEvent(QMouseEvent* event);
private:
    QString fileId;
    QByteArray content;
    bool loadContentDone = false;
};

#endif // HISTORYMESSAGEITEM_H
